package com.tjbank.cssys.web.config.threadPoolExample;

import com.tjbank.cssys.web.config.MybatisInterceptorConfig;
import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.Random;

/**
 * Created by hiker on 2020/8/22 16:43
 */
@Service
@Scope("prototype")
public class TaskOrder implements  Runnable{

    private static Logger logger = LoggerFactory.getLogger(TaskOrder.class);
    public String getTest() {
        return test;
    }

    public void setTest(String test) {
        this.test = test;
    }

    String test;



    @SneakyThrows
    @Override
    public void run() {
        try {
            Thread.sleep(100);
            System.out.println(getTest()+"  "+Thread.currentThread().getName()+new Random().nextInt(10));
        } catch (InterruptedException e) {
            logger.error("prototype异常",e.getMessage());
        }
    }
}
